package com.nf.health.app.inquiry.impl.viewholder;

import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.nf.health.app.R;
import com.nf.health.app.customview.CircleImageView;
import com.nf.health.app.customview.MyFlowLayout;
import com.nf.health.app.glide.GlideUtil;
import com.nf.health.app.inquiry.bean.DoctorDetailBean;
import com.nf.health.app.utils.GetToast;
import com.nf.health.app.utils.ViewUtil;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 家庭服务，详细信息  Viewholder   的 头布局
 */
public class DoctorHomeDescriptViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
    @Bind(R.id.iv_head_icon_doc_service)
    public CircleImageView iv_head_icon_doc_service;

    @Bind(R.id.doctor_name_doc_doc_service)//医生姓名
    public TextView doctor_name_doc_doc_service;

    @Bind(R.id.doctorname_address_service)//地址
    public TextView doctorname_address_service;

    @Bind(R.id.doctor_job_doc_service)
    TextView doctor_job_doc_service;//科室和医生类型
    ;
    @Bind(R.id.doctor_qianyue_doc_service)
    TextView doctor_qianyue_doc_service;//已签约用户


    private Activity cnt;
    public DoctorHomeDescriptViewHolder(View itemView, Activity cnt) {
        super(itemView);
        ButterKnife.bind(this, itemView);
        this.cnt = cnt;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case  R.id.ll_shouqi_icon_doc:
            case  R.id.tv_query_doc_detail:
                GetToast.useString(cnt, "成功啦");

                break;
        }
    }

    public void loadData(DoctorDetailBean doctorDetail){
        if(doctorDetail == null){
            return ;
        }
        GlideUtil.loadNetImg2(cnt, iv_head_icon_doc_service, doctorDetail.getDoctorhimg(), R.drawable.default_head);
        doctor_name_doc_doc_service.setText(TextUtils.isEmpty(doctorDetail.getDoctorname()) ? "未填写" : doctorDetail.getDoctorname());
        doctorname_address_service.setText(TextUtils.isEmpty(doctorDetail.getHospitalname()) ? "未知地址" : doctorDetail.getHospitalname());//医院地址
        String  source = TextUtils.isEmpty(doctorDetail.getNum()) ? "<font color='#FFF36A'>已经签约 0 个家庭</font>" :
                "<font color='#FFF36A'>已经签约 "+ doctorDetail.getNum() +" 个家庭</font>";
        doctor_qianyue_doc_service.setText(Html.fromHtml(source) );;//已签约用户
        String doctortype =TextUtils.isEmpty(doctorDetail.getDepartment()) ? "位置类型" : doctorDetail.getProfessional();
        doctor_job_doc_service.setText(TextUtils.isEmpty(doctorDetail.getDepartment()) ? "未填写" : doctorDetail.getDepartment()
                +" | "+doctortype);//专业（科室）
    }
}
